package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpYAccountCustomerDetailsAliasesTabPageUtil extends SeleniumPageUtil {
	
	public final static By CDAT_SPAN_MAIN_HEADER = By.id("ParentChildContainer_CustomerDetails_Aliases1_AliasReport_Header_lblHeader");
	public final static By CDAT_IMG_REPORT_PREFERENCES = By.id("ParentChildContainer_CustomerDetails_Aliases1_AliasReport_Header_imgPreferences");
	public final static By CDAT_IMG_EXPORT = By.id("ParentChildContainer_CustomerDetails_Aliases1_AliasReport_Header_imgExcelExport");
	public final static By CDAT_LINK_NEW = By.xpath("//*[@id='e0dce11b-40ad-4118-b5d9-84bb06c2b270']/a");
	public final static By CDAT_TD_PAGE = By.xpath("//*[@id='dvReport']/table[2]/tbody/tr/td[1]");
	public final static By CDAT_SPAN_PAGE_START_NO = By.id("ParentChildContainer_CustomerDetails_Aliases1_AliasReport_PagingTop_lblPagingPageNumber");
	public final static By CDAT_TD_OF = By.xpath("//*[@id='dvReport']/table[2]/tbody/tr/td[3]");
	public final static By CDAT_SPAN_PAGE_COUNT = By.id("ParentChildContainer_CustomerDetails_Aliases1_AliasReport_PagingTop_lblPagingPageCount");
	public final static By CDAT_INPUT_FIRST = By.id("ParentChildContainer_CustomerDetails_Aliases1_AliasReport_PagingTop_imgFirst");
	public final static By CDAT_INPUT_PREVIOUS = By.id("ParentChildContainer_CustomerDetails_Aliases1_AliasReport_PagingTop_imgPrevious");
	public final static By CDAT_INPUT_NEXT = By.id("ParentChildContainer_CustomerDetails_Aliases1_AliasReport_PagingTop_imgNext");
	public final static By CDAT_INPUT_LAST = By.id("ParentChildContainer_CustomerDetails_Aliases1_AliasReport_PagingTop_imgLast");
	public final static By CDAT_IMG_FILTER_0 = By.id("ParentChildContainer_CustomerDetails_Aliases1_AliasReport_filter_0");
	public final static By CDAT_TH_ALIAS = By.id("ParentChildContainer_CustomerDetails_Aliases1_AliasReport_sort_1");
	
	
	public static void enterYourAccountCustomerDetailsAliasPage(){
		SpHomePageUtil.enter();
		SpHomePageUtil.enterYourAccountCustomerDetailsDefaultPage();
		SeleniumUtil.click(SeleniumUtil.getCachedElement(SpYAccountCustomerDetailsDefaultPageUtil.YACD_TAB_ALIASES));
		waitForPageToLoad();
	}
	
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				CDAT_LINK_NEW, CDAT_IMG_REPORT_PREFERENCES, CDAT_IMG_EXPORT, CDAT_INPUT_FIRST, CDAT_INPUT_PREVIOUS, CDAT_INPUT_NEXT,
				CDAT_INPUT_LAST, CDAT_IMG_FILTER_0
			});
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDAT_LINK_NEW));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDAT_IMG_REPORT_PREFERENCES));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDAT_IMG_EXPORT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDAT_INPUT_FIRST));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDAT_INPUT_PREVIOUS));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDAT_INPUT_NEXT));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDAT_INPUT_LAST));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(CDAT_IMG_FILTER_0));
	}
}
